package model.entity;

import game_engine.core.Entity;
import game_engine.display.GEUtil;
import game_engine.display.Texture;
import game_engine.display.TextureLoader;

import java.awt.Color;
import java.awt.Rectangle;
import java.io.IOException;

public class Enemy2 extends Entity {
	
	public static int FRAME_NOMOVE = 0;
	
	
	private int width = 128;
	private int height = 128;

	public Enemy2(TextureLoader textureLoader, String name) {
		super(name);
		Texture[][] frames = new Texture[1][];
		Texture[] noMove = new Texture[11];
		try {
			for(int i = 1 ;i<=11;i++) {
				if(i<10)noMove[i-1] = textureLoader.getTexture("images/croco-attack_0" + i + ".png", new Color(0x61442b));
				else noMove[i-1] = textureLoader.getTexture("images/croco-attack_" + i + ".png", new Color(0x61442b));
		}
		} catch(IOException e) {
			e.printStackTrace();
		}
		frames[0] = noMove;

		int[][] framesCountList = new int[1][];
		int[] framesCount1 = new int[11];
		for(int i = 0 ;i<11;i++) {
			framesCount1[i] = 60;
		}
		framesCountList[0] = framesCount1;

		boolean[] frameLoop = new boolean[1];
		frameLoop[0] = true;
		currentFrame = 0;
		currentAction = FRAME_NOMOVE;

		boundingBox = new Rectangle(0, 0, 30, 30);

		this.setFrames(frames);
		this.setFrameCount(framesCountList);
		this.setFrameLoop(frameLoop);
	}
	
	public void render() {		
		if(position!=null) {
//			GEWindow.drawImage(frames[currentAction][currentFrame], position.x, position.y, 128, 128);
			GEUtil.drawImage(frames[currentAction][currentFrame], Math.round(position.x), Math.round(position.y), width, height, 255);
		}
	}

	@Override
	public void collided(Entity e) {
		
	}

	@Override
	public void doAction(float tick) {
	
	}

}
